package server;

public class MastermindServer {

	public static void main(String args[]){
		
		
		try{
			//initalize the server port if not specified default as 8800
			int serverPort = (args.length != 1 ? 8800 : Integer.parseInt(args[0]));
			//let user know server is starting
			System.out.println("Initializing Server...");
			
			//create new server listener
			ServerListener serverListener = new ServerListener(serverPort);
			
			//shut up and listen for connections
			serverListener.listen();
			
			//print statement when the server is finished
			System.out.println("Server ending");
		}
		
		
		//catches
		catch(NumberFormatException e){
			System.err.println("Invalid port number specified... server quitting..");
		}
		//unknown handling maybe dump???
		catch(Exception e){
			System.err.println("Unhandled Error encountered....");
			e.printStackTrace();
		}
		
		
		
	}
	
	
}
